
import time

from selenium.webdriver.common.by import By
from pages.trunk import Trunk


class Static(Trunk):
    ''''''
    '''MORE'''
    about_azazie_ele = (By.XPATH, "(//a[contains(text(),'About Azazie')])[1]")
    help_ele = (By.XPATH, "(//a[contains(text(),'Help')])[1]")
    site_ele = (By.XPATH, "(//a[contains(text(),'Site')])[1]")
    '''About Azazie'''
    blog_ele = (By.XPATH, "(//a[contains(text(),'Blog')])[2]")
    look_book_ele = (By.XPATH, "(//a[contains(text(),'Look Book')])[1]")
    about_us_ele = (By.XPATH, "(//a[contains(text(),'About Us')])[1]")
    careers_ele = (By.XPATH, "(//a[contains(text(),'Careers')])[1]")
    press_ele = (By.XPATH, "(//a[contains(text(),'Press')])[1]")
    partners_ele = (By.XPATH, "(//a[contains(text(),'Partners')])[1]")
    '''Help'''
    size_chart_ele = (By.XPATH, "(//a[contains(text(),'Size Chart')])[1]")
    dress_guide_ele = (By.XPATH, "(//a[contains(text(),'Dress Guide')])[1]")
    shipping_ele = (By.XPATH, "(//a[contains(text(),'Shipping')])[1]")
    payment_methods_ele = (By.XPATH, "(//a[contains(text(),'Payment Methods')])[1]")
    student_discount_ele = (By.XPATH, "(//a[contains(text(),'10% Student Discount')])[1]")
    return_policy_ele = (By.XPATH, "(//a[contains(text(),'Return Policy')])[1]")
    sign_up_for_email_ele = (By.XPATH, "(//a[contains(text(),'Sign Up For Email')])[1]")
    customer_support_ele = (By.XPATH, "(//a[contains(text(),'Customer Support')])[1]")
    contact_us_ele = (By.XPATH, "(//a[contains(text(),'Contact Us')])[1]")
    '''Site'''
    privacy_policy_ele = (By.XPATH, "(//a[contains(text(),'Privacy Policy')])[1]")
    terms_of_use_ele = (By.XPATH, "(//a[contains(text(),'Terms of Use')])[1]")
    accessibility_statement_ele = (By.XPATH, "(//a[contains(text(),'Accessibility Statement')])[1]")
    giveaways_and_contests_ele = (By.XPATH, "(//a[contains(text(),'Giveaways And Contests')])[1]")

    def __about_azazie(self):
        """点击About Azazie"""
        self.click_button(self.about_azazie_ele, desc="点击About Azazie")
        time.sleep(1)
        return self

    def __help(self):
        """点击Help"""
        self.click_button(self.help_ele, desc="点击Help")
        time.sleep(1)
        return self

    def __site(self):
        """点击Site"""
        self.click_button(self.site_ele, desc="点击Site")
        time.sleep(1)
        return self

    def __click_about_azazie_element(self, loc, desc, url_contains):
        """footer基础操作"""
        self.__about_azazie()
        self.click_button(loc, desc=desc)
        self.wait_url_contains(url_contains)
        return self

    def __click_help_element(self, loc, desc, url_contains):
        """footer基础操作"""
        self.__help()
        self.click_button(loc, desc=desc)
        self.wait_url_contains(url_contains)
        return self

    def __click_site_element(self, loc, desc, url_contains):
        """footer基础操作"""
        self.__site()
        self.click_button(loc, desc=desc)
        self.wait_url_contains(url_contains)
        return self

    def click_blog(self):
        """点击进入Blog页面"""
        return self.__click_about_azazie_element(self.blog_ele, "点击进入Blog页面", '/blog/')

    def click_look_book(self):
        """点击进入Look Book页面"""
        return self.__click_about_azazie_element(self.look_book_ele, "点击进入Look Book页面", '/look-book')

    def click_about_us(self):
        """点击进入About Us页面"""
        return self.__click_about_azazie_element(self.about_us_ele, "点击进入About Us页面", '/about_us')

    def click_careers(self):
        """点击进入Careers页面"""
        return self.__click_about_azazie_element(self.careers_ele, "点击进入Careers页面", '/careers')

    def click_press(self):
        """点击进入press页面"""
        return self.__click_about_azazie_element(self.press_ele, "点击进入press页面", '/press')

    def click_partners(self):
        """点击进入partners页面"""
        return self.__click_about_azazie_element(self.partners_ele, "点击进入partner页面", '/partner')

    def click_size_chart(self):
        """点击进入SIZE CHART页面"""
        return self.__click_help_element(self.size_chart_ele, "点击进入SIZE CHART页面", '/size_chart')

    def click_dress_guide(self):
        """点击进入Dress Guide页面"""
        return self.__click_help_element(self.dress_guide_ele, "点击进入Dress Guide页面", '/dress_guide')

    def click_shipping(self):
        """点击进入Shipping页面"""
        return self.__click_help_element(self.shipping_ele, "点击进入Shipping页面", '/hc/en-us/articles/360001805031-General-Shipping-Information')

    def click_payment_methods(self):
        """点击进入Payment Methods页面"""
        return self.__click_help_element(self.payment_methods_ele, "点击进入Payment Methods页面", '/payment_methods')

    def click_student_discount(self):
        """点击进入10% Student Discount页面"""
        return self.__click_help_element(self.student_discount_ele, "点击进入10% Student Discount页面", '/student_discount')

    def click_return_policy(self):
        """点击进入Return Policy页面"""
        return self.__click_help_element(self.return_policy_ele, "点击进入Return Policy页面", '/hc/en-us/articles/115005951206-What-is-your-return-policy')

    def click_sign_up_for_email(self):
        """点击进入Sign Up For Email页面"""
        return self.__click_help_element(self.sign_up_for_email_ele, "点击进入Sign Up For Email页面", '/sign_up_for_email')

    def click_customer_support(self):
        """点击进入Customer Support页面"""
        return self.__click_help_element(self.customer_support_ele, "点击进入Customer Support页面", 'support.azazie.com/hc/en-us')

    def click_contact_us(self):
        """点击进入Contact Us页面"""
        return self.__click_help_element(self.contact_us_ele, "点击进入Contact Us页面", '/hc/en-us/articles/360026475311-How-do-I-contact-you')

    def click_privacy_policy(self):
        """点击进入Privacy Policy页面"""
        return self.__click_site_element(self.privacy_policy_ele, "点击进入Privacy Policy页面", '/privacy_policy')

    def click_terms_of_use(self):
        """点击进入Terms of Use页面"""
        return self.__click_site_element(self.terms_of_use_ele, "点击进入Terms of Use页面", '/terms_of_use')

    def click_accessibility_statement(self):
        """点击进入Accessibility Statement页面"""
        return self.__click_site_element(self.accessibility_statement_ele, "点击进入Accessibility Statement页面", '/accessibility_statement')

    def click_giveaways_and_contests(self):
        """点击进入Giveaways And Contests页面"""
        return self.__click_site_element(self.giveaways_and_contests_ele, "点击进入Giveaways And Contests页面", '/giveaways_and_contests')
